package com.compass.doctor.ui.patient.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.R
import com.compass.doctor.databinding.LayoutInquiryBriefItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.glide.setUrlCircle
import com.compass.framework.manager.DictionariesManager
import com.compass.framework.model.PatientISeeRecord
import com.compass.framework.model.PatientInfo
import com.compass.framework.utils.DateUtils
import com.compass.framework.utils.getDrawableResource

/**
 * Description： 问诊小结adapter
 * Date:2023/12/8 10:51
 */
class InquiryBriefAdapter : BaseRecyclerViewAdapter<PatientISeeRecord, LayoutInquiryBriefItemBinding>() {
    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutInquiryBriefItemBinding>,
        item: PatientISeeRecord?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            tvReceptionTime.text= DateUtils.conversionTime(item.createTime, DateUtils.FORMAT_TWO)
            tvInquiryType.text= DictionariesManager.getOrderConsultationTypeString(item.type)
            tvConsultationLength.text= DateUtils.secondToDate(item.consultationLength)
            item.clinicalDiagnosis?.let {
                tvDiagnoseContent.text=it
            }?:kotlin.run {
                tvDiagnoseContent.text="暂无诊断"
            }
            tvRemark.text=item.proposalMsg
        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutInquiryBriefItemBinding {
        return LayoutInquiryBriefItemBinding.inflate(layoutInflater, parent, false)
    }
}